package org.sgr.money.manager.frame;

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;

public class WelcomComp extends Composite {

	private ToolBar toolBar = null;
	private SashForm sashForm = null;
	private Composite composite = null;
	private Composite composite1 = null;
	public WelcomComp(Composite parent, int style) {
		super(parent, style);
		initialize();
	}

	private void initialize() {
		this.setLayout(new FormLayout());
		createSashForm();
		setSize(new Point(300, 200));
	}

	/**
	 * This method initializes toolBar	
	 *
	 */
	private void createToolBar() {
		toolBar = new ToolBar(composite, SWT.V_SCROLL);
		ToolItem toolItem = new ToolItem(toolBar, SWT.PUSH);
		toolItem.setText("b1");
		ToolItem toolItem1 = new ToolItem(toolBar, SWT.PUSH);
		toolItem1.setText("b2");
		ToolItem toolItem2 = new ToolItem(toolBar, SWT.PUSH);
		toolItem2.setText("b3");
	}

	/**
	 * This method initializes sashForm	
	 *
	 */
	private void createSashForm() {
		sashForm = new SashForm(this, SWT.BORDER | SWT.V_SCROLL);
		sashForm.setOrientation(SWT.HORIZONTAL);
		FormData data = new FormData();
		data.top = new FormAttachment(0, 0); // Label与shell上边框相距1象素
		data.left = new FormAttachment(0, 0); // Label与shell左边框相距1象素
		data.bottom = new FormAttachment(100, 0);// Label在shell水平中线上方5象素
		data.right = new FormAttachment(100, 0); // Label在shell垂直中线左边5象素
		sashForm.setLayoutData(data);
		sashForm.setEnabled(false);
//		sashForm.setRegion(new Region());
		createComposite();
		createComposite1();
	}

	/**
	 * This method initializes composite	
	 *
	 */
	private void createComposite() {
		composite = new Composite(sashForm, SWT.NONE);
		composite.setLayout(new GridLayout());
		createToolBar();
	}

	/**
	 * This method initializes composite1	
	 *
	 */
	private void createComposite1() {
		composite1 = new Composite(sashForm, SWT.NONE);
		composite1.setLayout(new GridLayout());
	}

}
